package com.skynet.amqp.perfect;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;

public class PerfectRabbitReturnCallback implements RabbitTemplate.ReturnCallback {

    private static final Logger log = LoggerFactory.getLogger(PerfectRabbitReturnCallback.class);

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Override
    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
        log.info("message: {}", message);
        log.info("replyCode: {}", replyCode);
        log.info("replyText: {}", replyText);
        log.info("exchange: {}", exchange);
        log.info("routingKey: {}", routingKey);
        // rabbitTemplate.convertAndSend(exchange, routingKey, message);
    }
}
